package com.lmm.rpc.client.annotation;

import com.lmm.rpc.core.client.async.RpcCallback;
import com.lmm.rpc.core.common.enums.RpcSendType;
import org.springframework.beans.factory.annotation.Autowired;

import java.lang.annotation.*;

@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Autowired
public @interface RpcAutowired {
    /**
     * rpc调用方式  同步、异步、单向
     * 默认 同步
     * */
    RpcSendType rpcSendType() default RpcSendType.SYNC;
    /**
     * 负载策略选择
     * */
    String iLoadBalancer() default "";

    /**
     * 环境
     * */
    String env() default  "dev";
    /**
     * 本地直连
     * */
    String serverIpPorts() default "";

    /**
     * 连接超时时间
     * */
    int connTimeout() default 5*1000;

    /**
     * 是否支持重试
     * */
    boolean retryRequest() default true;

    /**
     * 重试次数
     * */
    int retryTimes() default 3;

    //池 相关的配置参数
    int maxTotal() default  100;

    int maxIdle() default 50;

    int minIdle() default  10;

    boolean lifo() default true;

    boolean fairness() default  false;
    long maxWaitMillis() default 30 *1000;

    long timeBetweenEvictionRunsMillis() default 3 * 60 * 1000;

    long minEvictableIdleTimeMillis() default  5 * 60 * 1000;

    long softMinEvictableIdleTimeMillis() default 10 * 60 * 1000;

    int numTestsPerEvictionRun() default 20;

    boolean testOnCreate() default  false;

    boolean testOnBorrow() default  false;

    boolean testOnReturn() default  false;

    boolean testWhileIdle() default  true;

    boolean removeAbandonedOnBorrow() default  true;

    boolean removeAbandonedOnMaintenance() default  true;

    int removeAbandonedTimeout() default  30;
}
